#prac01
n = eval(input())
for i in range(10**(n - 1), 10**n):
    sum = 0
    icopy = i
    while i > 0:
        sum += (i % 10)**n
        i = i // 10
    if sum == icopy:
        print(icopy)

#prac02
class myStack:
    def __init__(self):
        self.lt = []
    def push(self, item):
        self.lt.append(item)
    def pop(self):
        return self.lt.pop()
    def top(self):
        return self.lt[-1]
    def isEmpty(self):
        return self.length() == 0
    def length(self):
        return len(self.lt)
    def iterate(self):
        for i in self.lt:
            print(i, end = "")
        print()

#prac03
import numpy as np

arr1 = np.empty([4, 6], dtype=int)
arr2 = np.ones([1, 6], dtype=int)
arrSum = arr1 + arr2
arrSum.reshape([3, 8])
arrSum.sort()

#prac04
from matplotlib import pyplot as plt
import random

plt.subplot(1, 2, 1)
xlt = [1, 2, 3, 4, 5, 6]
ylt = [random.randint(1, 51) for i in range(6)]
plt.plot(xlt, ylt)

plt.subplot(1, 2, 2)
plt.scatter(xlt, ylt)

plt.show()